<template>
  <ul class="file-list">
    <li v-if="props.files.length == 0">暂无文件</li>
    <li :class="['align-center', index == 0 ? '' : 'm-t-8']" v-for="(item, index) in props.files" :key="index">
      {{ index + 1 }}、<el-link type="primary" @click="openFile(item.url)">{{ item.name }}</el-link>
    </li>
  </ul>
</template>

<script lang="ts" setup>
  import { IFile } from './typing';

  const props = defineProps<{
    files: IFile[];
  }>();

  const openFile = (url: string) => window.open(url);
</script>
